import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
//引入cookies
import VueCookies from 'vue-cookies'
//引入element-plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './assets/base.scss'
//引入字体图标
import './assets/icon/iconfont.css'
//全局组件
import Dialog from '@/components/Dialog.vue'
import Avatar from '@/components/Avatar.vue'
import Cover from './components/Cover.vue'
import Table from './components/Table.vue'
import CoverUpload from './components/CoverUpload.vue'
//全局方法 正则校验
import Veryfy from './utils/Veryfy'
import Message from './utils/Message'
//axios请求
import request from '@/utils/request.js'
import Utils from './utils/Utils'
import Confirm from './utils/Confirm'
const app = createApp(App)

app.use(router)
app.use(ElementPlus)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
//全局挂载VueCookies
app.config.globalProperties.VueCookies = VueCookies;
app.config.globalProperties.globalInfo = {
    bodyWidth: 1300,
    avatarUrl: "/api/file/getAvatar/",
    imageUrl: "/api/file/getImage/",
    webDomain: import.meta.env.VITE_WEB_DOMAIN,
}
//正则校验
app.config.globalProperties.veryfy = Veryfy
app.config.globalProperties.Message = Message
//axios请求
app.config.globalProperties.request = request
app.config.globalProperties.Utils = Utils
app.config.globalProperties.Confirm = Confirm

app.component('Dialog', Dialog)
app.component('Cover', Cover)
app.component('Table', Table)
app.component('Avatar', Avatar)
app.component('CoverUpload', CoverUpload)

app.mount('#app')
